
from __future__ import print_function

import librosa
import matplotlib.pyplot as plt
import librosa.display

class AudioAnalyse():
    def __init__(self, filename):
        self.audiofile = filename

    def do_analyse(self):
        audio_data, sr = librosa.load(self.audiofile)
        mfcc = librosa.feature.mfcc(audio_data, sr=sr, n_mfcc=40)
        S = librosa.feature.melspectrogram(y=audio_data, sr=sr, n_mels=40, fmax=8000)
        mfcc_one = librosa.feature.mfcc(S=librosa.power_to_db(S))
        # print(mfcc)
        plt.figure()
        plt.subplot(1,1,1)
        # plt.colorbar()
        librosa.display.specshow(mfcc_one)
        plt.title("hello")
        plt.show()